<template>
  <div class="bg">
    <nav-com
      :title="title"
      :showView='true'
      @back="backHandler()"
    ></nav-com>
    <div
      class="orders_list"
    >
      <div
        class="order_box_title"
        style="display: flex; justify-content: space-between;  padding-top:5px;  margin-right: 10px;align-items: center;"
      >
        <div style=" max-width: 250px; white-space: nowrap; text-overflow: ellipsis;overflow: hidden;">订单编号:{{dataInfo.order_sn}}</div>
      </div>
      <div class="order_box">
        <img :src="dataInfo.goods_image">
        <div>
          <p>{{dataInfo.goods_title}}</p>
          <p style="font-size:12px;">数量：{{dataInfo.goods_num}}</p>
          <span>￥{{dataInfo.goods_price}}</span>
        </div>
      </div>
      <div class="order_bottom">商品总价：<span style="color:#FE4B20">￥{{dataInfo.goods_price}}</span></div>
      <div style="clear:both;"></div>
    </div>
    <div
      class="orders_list"
      style="padding:3vw 0"
    >
      <div class="item_list">
        <div class="title">实际退款</div>
        <div>￥{{dataInfo.goods_price}}</div>
      </div>
      <div class="item_list">
        <div class="title">退款位置</div>
        <div>{{dataInfo.back}}</div>
      </div>
      <div class="item_list">
        <div class="title">交易时间</div>
        <div>{{dataInfo.createtime}}</div>
      </div>
      <div class="item_list">
        <div class="title">退货原因</div>
        <div>{{dataInfo.user_reason}}</div>
      </div>
    </div>
    <div
      class="orders_list"
      style="min-height:15vh"
      v-if="dataInfo.aftersale_status==-1"
    >
      <div
        class="order_box_title"
        style="display: flex; justify-content: space-between;  padding-top:5px;  margin-right: 10px;align-items: center;"
      >
        <div style=" max-width: 250px; white-space: nowrap; text-overflow: ellipsis;overflow: hidden;color:#000;font-size:4vw">退款失败理由</div>
      </div>
      <div
        class="order_box"
        style="margin:3vw;color:#808080;border-bottom:none"
      >
        {{dataInfo.admin_reason}}
      </div>
    </div>
  </div>
</template>

<script>
import navCom from "@/component/nav";
import { deleteAfterSalesDetail } from "@/api/api";
export default {
  components: {
    navCom,
  },
  data() {
    return {
      title: "成功",
      dataInfo: {},
    };
  },
  mounted() {
    this.id = this.$route.params.id;
    this.initData(this.id);
  },
  methods: {
    backHandler() {
      this.$router.go(-1);
    },
    initData(id) {
      deleteAfterSalesDetail({ id })
        .then((result) => {
          if (result.data.code == 1) {
            this.dataInfo = result.data.data;
            if (result.data.data.aftersale_status == -1) {
              this.title = "退款失败";
            } else if (result.data.data.aftersale_status == 2)
              this.title = "退款成功";
          }
        })
        .catch((err) => {});
    },
  },
};
</script>

<style scoped>
p {
  padding: 0;
  margin: 0;
}
.item_list {
  display: flex;
  justify-content: space-between;
  margin: 0 2vw;
  font-size: 3.4vw;
  line-height: 7vw;
}
.item_list .title {
  color: #808080;
  min-width: 20vw;
}
.bg {
  background: #f2f3f7;
  min-height: 100vh;
}
.orders_list {
  background: #fff;
  position: relative;
  margin: 4vw;
  border-radius: 10px;
}
.order_box_title {
  height: 9.3vw;
  font-size: 3.2vw;
  padding-left: 2.93vw;
  line-height: 9.3vw;
  color: #999;
  border-bottom: 1px solid #eeeeee;
}
.order_box {
  display: flex;
  border-bottom: 1px solid #eeeeee;
  padding-bottom: 10px;
}
.order_box img {
  width: 24vw;
  height: 24vw;
  padding-top: 3.3vw;
  padding-left: 2.93vw;
}
.order_box p {
  padding-left: 4vw;
  padding-top: 3vw;
  color: #333;
}
.order_box span {
  padding-left: 4vw;
  padding-top: 3vw;
  display: block;
  color: #ff0000;
  font-size: 18px;
}
.order_bottom {
  padding: 2vw 2.93vw;
  color: #808080;
  font-size: 13px;
  float: right;
  /* margin-left: 55.7vw; */
  
}
</style>